import React, { Component } from 'react'
import { Button, Modal, Select, Form, Row, Col, Input, Radio, DatePicker, message } from 'antd';
import { connect } from 'dva';
import BaseComponent from '@/components/BaseComponent';
import moment from 'moment';
import ReportCard from '@/components/ReportCard';
import ImageDragger from '@/components/ImageDragger'


@connect(({ user }) => ({
    // data: risk.riskData,
    currentUser: user.currentUser,
}))

export default class index extends BaseComponent {
    constructor(props) {
        super(props)
        this.state = {
            visible: false,
            form: {
            },
        }
    }

    showModal = () => {
        this.selById()
        this.setState({
            visible: true,
        });
    };

    handleOk = () => {
        this.setState({
            visible: false,
        });
    };

    handleCancel = () => {
        this.setState({
            visible: false,
            form: {}
        });
    };



    /**详情*/
    selById = () => {
        this.execHttp('summaryfAnnualReport/selById', {
            id: this.props.record.id
        }).then(resp => {
            if (resp && resp.success) {
                this.setState({
                    form: resp.data,
                })
            }
        });
    };



    render() {
        const { visible } = this.state;
        const formItemLayout = {
            labelCol: {
                xs: { span: 24 },
                sm: { span: 8 },
            },
            wrapperCol: {
                xs: { span: 24 },
                sm: { span: 16 },
            },
        };


        return (
            <div>
                <Button type="primary" onClick={this.showModal} >查看</Button>
                <Modal
                    title="查看"
                    visible={visible}
                    onOk={this.handleOk}
                    onCancel={this.handleCancel}
                    width={1200}
                >
                    <Form {...formItemLayout} >
                        <Row gutter={16}>
                            <Col span={8}>
                                <Form.Item label="所属省份">
                                    <Input placeholder="所属省份" value={this.state.form.provinceName}
                                        style={{ width: 200 }} />
                                </Form.Item>
                            </Col>
                            <Col span={8}>
                                <Form.Item label="所属城市">
                                    <Input placeholder="所属城市" value={this.state.form.cityName}
                                        style={{ width: 200 }} />
                                </Form.Item>
                            </Col>
                            <Col span={8}>
                                <Form.Item label="所属区/县">
                                    <Input placeholder="所属区/县" value={this.state.form.districtName}
                                        style={{ width: 200 }} />
                                </Form.Item>
                            </Col>
                        </Row>
                        <Row gutter={16}>

                            <Col span={8}>
                                <Form.Item label="机构名称">
                                    <Input placeholder="请输入机构名称" value={this.state.form.institutionName}
                                        style={{ width: 200 }} />
                                </Form.Item>
                            </Col>
                            <Col span={8}>
                                <Form.Item label="筛查年度">
                                    <Input placeholder="请输入筛查年度" value={this.state.form.screeningYear}
                                        style={{ width: 200 }} />
                                </Form.Item>
                            </Col>

                        </Row>
                        <Row gutter={16}>
                            <Col span={8}>
                                <Form.Item label="查看图片">
                                    <ReportCard
                                        imagePreview={true}
                                        emptyMsg={'暂无图片,请上传图片'}
                                        fileUrl={this.state.form.url}
                                        delButton={true}
                                    ></ReportCard>
                                </Form.Item>
                            </Col>
                        </Row>
                    </Form>
                </Modal>


            </div>
        )
    }
}
